package proxy.JDKDynamicProxy;

import java.lang.reflect.Proxy;

public class JDKDynamicProxyTest {
    public static void main(String[] args) {
        Tenant tenant = new Tenant();
        tenant.setName("王五");
        //创建调用处理器
        TenantHandler<Person> tenantHandler = new TenantHandler<Person>(tenant);
        //生成代理对象
        Person rentalAgency = (Person) Proxy.newProxyInstance(Person.class.getClassLoader(), new Class[]{Person.class}, tenantHandler);
        rentalAgency.giveHouse();
    }
}
